//import apiService from '../service/apiService';
//import md5 from './md5';
import { login } from '@/api/user'
export const uerserLogin = async function () {
     let mobileStr = window.localStorage.getItem('android_mobile');
     let passwordStr = window.localStorage.getItem('android_password');
     let loginTypeStr = window.localStorage.getItem('android_loginType');
     let apiHostStr = window.localStorage.getItem('android_apihost');
   
     if(!mobileStr) {
       mobileStr = "18800000002";
     }
     if(!passwordStr) {
      passwordStr = "123456";
    }
    if(!loginTypeStr) {
      loginTypeStr = "1";
    }
    if(!apiHostStr){
      window.localStorage.setItem('android_apihost', 'https://test-env2-teacher.train.newpage.ink');
    }
    
    let params = {
      mobile: mobileStr,
      password: passwordStr,
      loginType: loginTypeStr
    };
    // console.log("0000000");
    // let aa = await login(params);
    // console.log("1111");
    // console.log(aa);
    login(params).then( response => {
      console.log("11111111111");
      console.log(response);
      window.localStorage.setItem('android_token', response.data.token);
      console.log("222222222222");
    }, err => {
      console.log("3333");
      console.log(err);
      console.log("44444");
    })
};
